<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class AdminWxMaterialCategoryPost extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'material_type' => 'required',
            'name' => 'required',
            'order_num' => 'integer|min:0',
        ];
    }

    /**
     * 定义错误提示消息
     * @return array
     */
    public function messages()
    {
        return [
            'material_type.required' => '请指定该分类的素材类型',
            'name.required' => '请输入分类名称',
            'order_num.min' => '排序数值必须大于或等于0',
        ];
    }
}
